package com.yugao.fintech.draper.admin.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yugao.fintech.draper.admin.entity.SysRoleMenu;
import com.yugao.fintech.draper.admin.mapper.RoleMenuMapper;
import com.yugao.fintech.draper.admin.service.RoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleMenuServiceImpl implements RoleMenuService {
    @Autowired
    private RoleMenuMapper roleMenuMapper;

    @Override
    public void addRoleMenuList(List<SysRoleMenu> sysRoleMenuList) {
        sysRoleMenuList.forEach(roleMenuMapper::insert);
    }
    @Override
    public void deleteRoleMenuByRoleId(Long id) {
        roleMenuMapper.delete(Wrappers.<SysRoleMenu>lambdaQuery().eq(SysRoleMenu::getRoleId, id));
    }
    @Override
    public List<SysRoleMenu> getRoleMenuByRoleIds(List<Long> roleIds) {
        return roleMenuMapper.selectList(Wrappers.<SysRoleMenu>lambdaQuery().in(SysRoleMenu::getRoleId, roleIds));
    }
}
